<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%@ page import="java.util.SimpleTimeZone" %>
<%@ page import="com.google.appengine.api.users.User" %>
<%@ page import="com.google.appengine.api.users.UserService" %>
<%@ page import="com.google.appengine.api.users.UserServiceFactory" %>

<html>
  <head>
    <title>Navidar</title>
    <link rel="stylesheet" type="text/css" href="css/main.css"/>
    <meta charset="utf-8">
  </head>
  <body>
<%
	SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd hh:mm");
	fmt.setTimeZone(new SimpleTimeZone(0, ""));

	UserService userService = UserServiceFactory.getUserService();
	User user = userService.getCurrentUser();
	if (user != null) {
%>
	<div style="width: 100%;">
		<div class="line"></div>
		<div class="topLine">
			<div style="float: left;">
				<img src="favicon.ico" />
			</div>
			<div style="float: left;" class="headline">Navidar</div>
			<div style="float: right;">
				Bienvenido,
				<%=user.getNickname()%>! Si quieres <a
					href="<%=userService.createLogoutURL(request.getRequestURI())%>">puedes
					cerrar sesion</a>.
			</div>
		</div>
	</div>
	<jsp:include page="menu.jsp"></jsp:include>
  
<%
  	} else {
  %>
<div class="line"></div>
<div class="topLine">
Bienvenido
<a href="<%=userService.createLoginURL(request.getRequestURI())%>">ingrese o registrese</a>
</div>

<%
	}
%>
<div class="topLine">Hora: <%=fmt.format(new Date())%></div>
  </body>
</html>